<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
       "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
  <meta http-equiv="content-type" content="text/html;charset=UTF-8" />
  <title><%=h controller_name %>: <%=h controller.action_name %></title>
  <%= stylesheet_link_tag 'scaffold' %>
  <%= stylesheet_link_tag 'application' %>
</head>
<body>

<div class="topbar">
  <div class="float_left">
    Welcome, <%=h User.find(session[:user_id]).name %> &nbsp;&nbsp;<%= link_to 'Logout', :controller => 'admin', :action => 'logout' %>
  </div>
  
  <div class="float_right">
    <%= link_to 'Browse Books', :controller => 'books', :action => 'index' %>
    <% if User.find(session[:user_id]).is_admin %>
      <%= link_to 'Borrow Records', :controller => 'borrow_recs', :action => 'index'%>
      <%= link_to 'All Messages', :controller => 'messages', :action => 'index'%>
      <%= link_to "All Users", :controller => "users", :action => "index"%>
    <% else %>
      <%= link_to 'Borrowed Books', :controller => 'borrow_recs', :action => 'get_by_uid', :id => session[:user_id] %>
      <%= link_to 'Inbox', :controller => 'messages', :action => 'in_get_by_uid', :id => session[:user_id] %>
      <%= link_to 'Outbox', :controller => 'messages', :action => 'out_get_by_uid', :id => session[:user_id] %>
    <% end %> 
  </div>
  <br/>
</div>
<hr />

<p style="color: red"><%= flash[:error] %></p>
<p style="color: green"><%= flash[:notice] %></p>

<h1 align="center">Artifact Library Management</h1>

<%= yield %>

</body>
</html>
